package com.cbts.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Gift entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gift", catalog = "cbts", uniqueConstraints = @UniqueConstraint(columnNames = "giftName"))
public class Gift implements java.io.Serializable {

	// Fields

	private Integer giftId;
	private String giftName;
	private Double giftValue;
	private Integer number;
	private String description;
	private Set<ExchangeRecord> exchangeRecords = new HashSet<ExchangeRecord>(0);

	// Constructors

	/** default constructor */
	public Gift() {
		giftValue=0.10;
		number = 0;
	}

	/** minimal constructor */
	public Gift(Integer giftId, String giftName, Double giftValue,
			Integer number) {
		this.giftId = giftId;
		this.giftName = giftName;
		this.giftValue = giftValue;
		this.number = number;
	}

	/** full constructor */
	public Gift(Integer giftId, String giftName, Double giftValue,
			Integer number, String description,
			Set<ExchangeRecord> exchangeRecords) {
		this.giftId = giftId;
		this.giftName = giftName;
		this.giftValue = giftValue;
		this.number = number;
		this.description = description;
		this.exchangeRecords = exchangeRecords;
	}

	// Property accessors
	@Id
	@Column(name = "giftId", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY) 
	public Integer getGiftId() {
		return this.giftId;
	}

	public void setGiftId(Integer giftId) {
		this.giftId = giftId;
	}

	@Column(name = "giftName", unique = true, nullable = false, length = 45)
	public String getGiftName() {
		return this.giftName;
	}

	public void setGiftName(String giftName) {
		this.giftName = giftName;
	}

	@Column(name = "giftValue", nullable = false, precision = 11)
	public Double getGiftValue() {
		return this.giftValue;
	}

	public void setGiftValue(Double giftValue) {
		this.giftValue = giftValue;
	}

	@Column(name = "number", nullable = false)
	public Integer getNumber() {
		return this.number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}

	@Column(name = "description", length = 225)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "gift")
	public Set<ExchangeRecord> getExchangeRecords() {
		return this.exchangeRecords;
	}

	public void setExchangeRecords(Set<ExchangeRecord> exchangeRecords) {
		this.exchangeRecords = exchangeRecords;
	}

}